<?php

namespace app\common\validate;

use think\Validate;
use think\Db;

class SystemConfig extends Validate {

    //定义验证规则
    protected $rule = [
        'name|用户姓名' => 'require',
        'serverFeeExplain|服务费用说明' => 'require',
        'examExplain|考试说明' => 'require',
        'publishExplain|发布说明' => 'require',
        'faceValue|刷脸分值' => 'number|between:1,100|require',
        'realValue|实名认证分值' => 'number|between:1,100|require',
        'dataValue|信息完善分值' => 'number|between:1,100|require',
        'safeValue|安全认证分值' => 'number|between:1,100|require',
        'safeTestValue|安全考试分值' => 'number|between:1,100|require',
        'friendInviteValue|朋友邀请分值' => 'number|between:1,100|require',
        'firstInviteReward|一级推荐赏金比率'=>'checkNumber:thinkphp|require',
        'secondInviteReward|二级推荐赏金比率'=>'checkNumber:thinkphp|require',
        'thirdInviteReward|三级推荐赏金比率'=>'checkNumber:thinkphp|require',
        'secondInviteValue|二级推荐赏金所需魅力值'=>'number|require',
        'thirdInviteValue|三级推荐赏金所需魅力值'=>'number|require',
        'lightenFee|点亮好雇主、阿姨费用'=>'number|require',
        'vipMoney|月卡费用'=>'number|require',
        'hotline|客服联系方式'=>'require',


];


/**
 * 检查赏金比率 加入了唯一验证
 *
 */
protected function checkNumber($value) {
    $res = true;
    if(preg_match('/^0+(.[0-9]{1,2})?$/',$value)){
        $res = true;
    } else {
        $res = "赏金比率只能为0到0.99的小数";
    }
    return $res;
}

//定义验证提示
    protected $message = [
    ];


}
